import { jsx as _jsx } from "react/jsx-runtime";
import React, { PureComponent } from "react";
export function DevLogicPopup(WrappedComponent) {
    return class extends PureComponent {
        PopupRef;
        defaultConfig = {
            width: "400",
            height: "200",
            toolbarDisplay: true,
        };
        render() {
            this.PopupRef = React.createRef();
            let props = {
                ...this.defaultConfig,
                ...this.props,
            };
            const { onOK, onCancel, okText, cancelText, okDisabled, cancelDisabled, toolbarDisplay, okCallbackShow, } = props;
            return (_jsx(WrappedComponent, { ...props, ref: this.PopupRef, dragOutsideBoundary: true, resizeEnabled: true, toolbarItems: toolbarDisplay
                    ? [
                        {
                            widget: "dxButton",
                            toolbar: "bottom",
                            location: "after",
                            disabled: cancelDisabled,
                            options: {
                                visible: !okCallbackShow,
                                text: cancelText ?? "取消",
                                onClick: () => onCancel(),
                            },
                        },
                        {
                            widget: "dxButton",
                            toolbar: "bottom",
                            location: "after",
                            disabled: okDisabled,
                            options: {
                                text: okText ?? "确定",
                                type: "default",
                                visible: true,
                                onClick: () => onOK(),
                            },
                        },
                    ]
                    : "", children: this.props.children() }));
        }
    };
}
